<?php global $cv_option; ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lt IE 9]>
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->

<title><?php hybrid_document_title(); ?></title>

<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="all" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

<?php wp_head(); // wp_head ?>
</head>

<body class="<?php hybrid_body_class(); ?>" style="">
<div id="container" class="clearfix">
	
		<div id="header" class="clearfix">	
			
			<div class="top-banner">
						
				<?php get_template_part( 'menu', 'secondary' ); // Loads the menu-primary.php template. ?>	
				
			</div><!-- .top-banner -->	
			
			<div class="top-content">
		
				<div class="center clearfix">
				
					<div id="branding">								
							<?php $logo = ($cv_option['logo'] <> '') ? $cv_option['logo'] : get_bloginfo('template_directory').'/images/'.'logo.png'; ?>
							<a href="<?php echo get_bloginfo('siteurl'); ?>"><img src="<?php echo esc_url($logo); ?>" alt="Logo" id="logo"/></a>								
					</div><!-- #branding -->	
					
					<div class="breadcrumb-catetory">
						<?php
						if(is_single() || is_category()) {
							//Get all terms associated with post in taxonomy 'category'
							$terms = get_the_terms(get_the_ID(),'category');
									
							if ( $terms && ! is_wp_error( $terms ) ) {
									
								//Get an array of their IDs
								$term_ids = wp_list_pluck($terms,'term_id');

								//Get array of parents - 0 is not a parent
								$parents = array_filter(wp_list_pluck($terms,'parent'));

								//Get array of IDs of terms which are not parents.
								$term_ids_not_parents = array_diff($term_ids,  $parents);

								//Get corresponding term objects
								$terms_not_parents = array_intersect_key($terms,  $term_ids_not_parents);
								//echo $terms_not_parents; 
								
								foreach($terms_not_parents as $t) {										
									echo $t->name;
									break;
								}
							}
						} ?>
					</div>
					
					<?php get_template_part('searchform'); ?>	
					
				</div><!-- .center -->
		
			</div><!-- .top-content -->
			
			<div class="primary-menu-banner clearfix">
		
				<div class="center">
					<?php get_template_part( 'menu', 'primary' ); // Loads the menu-primary.php template. ?>	
					<?php if($cv_option['featured_tags']) { ?>
						<div class="featured-topics">
							<span class="before"><?php _e("Featured: ", hybrid_get_textdomain());?></span>
							<?php $pieces = explode(",", $cv_option['featured_tags']);
							foreach($pieces as $piece) { ?>								
								<a href="<?php echo get_tag_link(get_tag_id_by_name($piece)); ?>" ><?php echo $piece; ?> </a>
							<?php } ?>
						</div><!-- .featured-topics -->
					<?php } ?>
				</div><!-- .center -->
			
			</div><!-- .primary-menu-banner -->		
				
		</div>	<!-- #header -->